<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" href="${ctx}/css/base.css">
<link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all">
<link rel="stylesheet" href="${ctx}/layui/css/asset-in-view.css" media="all">
<script src="${ctx}/js/jsutils.js"></script>
<script type="text/javascript"></script>
<style type="text/css">
	.layui-table-box{
		height:550px;
	}
</style>
</head>
<body>
	<div id="refuseWindow" class="formstyle">
		<form id="refuseSubmit" method="post"

			onsubmit="return checkSubmit();">
			<s:token />
			<input name="assetId" id="assetId" type="hidden"
				value="${id }">
			<table style="border: 0px; width: 100%;text-align: center;" >
				<tr>
					<td><label>驳回理由:</label></td>
					<td style="text-align: left;width: 200px;height: 150px">
						<textarea style="width: 260px;height: 100px" id="refuseReason" name="refuseReason"></textarea>
					</td>
				</tr>
				<tr><td colspan="2"><HR style="FILTER: alpha(opacity=100,finishopacity=0,style=3)" width="100%" color=#987cb9 SIZE=3></td></tr>
				<tr>
					<td></td>
					<td style="text-align: right;"><input class="layui-btn layui-btn-primary" type="button" onclick="cancel()" value="取消" /></td>
					<td style="text-align: center"><input class="layui-btn layui-btn-primary" type="button" onclick="confirmRefuse(${id })" value="确定"  /></td>
				</tr>
			</table>

		</form>
	</div>
</body>
	<script src="${ctx}/js/jquery.min.js"></script>
	<script src="${ctx}/layui/layui/layui.all.js"></script>
<script type="text/javascript">
	function cancel() {
		setTimeout(function(){
			parent.layer.close(parent.layer.index);
			parent.parent.layer.close(parent.parent.layer.index);
		}, 500);
	}
	function confirmRefuse(obj){
		var refuseReason = $("#refuseReason").val();
		if( window.confirm("确定要驳回吗？") ) {
			if ($('#refuseReason').val() == '') {
				alert('请输入拒绝原因！');
				$('#refuseReason').focus();
				return false;
			}
			
		   $.ajax({
               type:"post",
               url:"${pageContext.request.contextPath}/assetscrap/refuseAssetsScrap.shtml?assetId=" + obj + "&refuseReason="+refuseReason,
               dataType : "json",
  			   contentType: "application/json; charset=UTF-8",
               success:function(d){
                   if(d.code=='success'){
                       layer.msg(d.msg);
                   }else{
                       layer.msg(d.msg);
                   }

				   setTimeout(function(){
					   parent.layer.close(parent.layer.index);
					   parent.parent.layer.close(parent.parent.layer.index);
				   }, 2000);
				   
				   parent.parent.parent.refreshAssetScrapList();
               },
  			   error:function(d){
  				 var result = d;
  				 var code = result.responseText;
  			   }
           });
		   
		}
		setTimeout(function(){
			parent.layer.close(parent.layer.index);
			parent.parent.layer.close(parent.parent.layer.index);
		}, 2000);
	}
	
	
</script>
</html>